You are here: Trading System Programming > Reference > Classes > Execution > Execution Methods > getPrice

getPrice

The getPrice method returns execution's original price.

Syntax

var getPrice();

Return Value

This method returns a floating value representing execution's price.

Example

The following example demonstrates the use of getPrice() method.

 

function start()

{

//retrieve account's executions orders

var account = getAccount();

var executions = account.getExecutions(getSymbol());

 

//loop through all executions and calculate average price value

 

var totalPrices = 0;

for(var i = 0; i < executions.length, i++)

{

var execution = executions[i];

 

totalPrices += execution.getPrice();

}

 

//calculate average price value for all executions

var averagePrice = totalPrices / executions.length;

}

 


Copyright © 2006-2009 ActiveTick LLC